home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Wayzata's Best of Shareware PC/Windows 1
/
Wayzata's Best of Shareware for PC-Windows - Release 1 - Wayzata Technology (1993).iso
/
mac
/
DOS
/
PROGRAMG
/
PBBACK10
/
PBBACK.DOC
< prev
next >
Wrap
Text File
|
1992-11-08
|
24KB
|
527 lines
The PBBack Library
=--------------------=
Version 1.0
PBBACK Copyright (c) 1990-1992 Thomas G. Hanlin III
This is PBBack, a library of more than 300 assembly language
routines for use with all versions of QuickBasic, particularly
QuickBasic 1.0-3.0. The PBBack library is copyrighted and may
be distributed only under the following conditions:
All PBBack files must be distributed together as a unit.
No files may be altered, added, or deleted from this unit.
You use this library at your own risk. It has been tested by
me on my own computer, but I will not assume any responsibility
for any problems which PBBack may cause you. If you do run
into a problem, please let me know about it, and I will do my
best to verify and repair it.
It is expected that if you find PBBack useful, you will
register your copy. You may not use PBBack routines in
programs intended for sale unless you have registered.
Registration gets you the latest version of PBBack, complete
with full source code. The assembly language code is designed
for MASM 6.0 and may require alteration for other assemblers.
If you are using QuickBasic 4.0-4.5 or another fairly recent
Microsoft BASIC compiler, you will find that my PBClone library
provides better support. The PBBack library is designed for
compatibility across the entire range of QuickBasic compilers,
from QB 1.0 to the final QB 4.5 release.
Note that only static arrays may be used with PBBack routines
at the moment. You may use dynamic arrays in your program, but
they must not be passed to PBBack routines. If you are using
QuickBasic 4.x, use its VARSEG and VARPTR functions to get the
address of the array. For earlier versions of QuickBasic, use
the ArrayPtr routine provided with PBBack. Note that you can't
pass arrays to PBBack routines in the QB 4.x editor/compiler,
since that always uses dynamic arrays.
PBBack is compatible with BASCOM/PDS as well as QuickBasic, but
does not support far strings. The QBX editor/compiler always
uses dynamic arrays, like QB 4.x, so the same caveat applies.
PBBack is easier to use than PBClone since it does not need
declarations, among other things. By the same token, however,
the compiler is not able to detect type mismatch errors or
other common problems when calling PBBack routines. If a
routine doesn't seem to work, make sure you're calling it
correctly. In particular, most routines do expect integer
values, and won't work if you pass floating point instead.
Routine Reference
Array Management:
AddMatI add to each element of an integer array
ArrayPtr return the segment and offset of an array
DRecDel delete a record or element from an array
DRecIns insert a record or element into an array
InitPtr initialize an array of pointers
MulMatI multiply each element of an integer array
SetMatI set each element of an integer array
SortI sort an array of integers
Disk:
CDROM see if a CD-ROM is installed and get info
DelSub delete a subdirectory
DrvType see if a drive is removeable and/or networked
FindFirstF find the first file to match specs
FindNextF find any other files which match specs
FloppyType see what types of floppy drives are installed
GetAttrF get attribute of a file matched by FindFirstF
GetDateF get date of a file matched by FindFirstF
GetExecPath get drive, subdir, name of current program
GetLabel get a disk volume label
GetNameF get the name of a file matched by FindFirstF
GetSub get the default subdirectory
GetSub1 get the default subdirectory on a given drive
GetTimeF get the time of a file matched by FindFirstF
GetVerify determine status of the DOS "verify" setting
LoadDir load names of matching files into an array
MakeSub create a subdirectory
RenSub rename a subdirectory
Retries set the retries used for file networking
SetDrv set the default drive
SetSub set the default subdirectory
SetVerify set the state of the DOS "verify" switch
Routine Reference
Display:
BigPrint display text in huge letters
BkSpace backspace destructively with wrap
BkScroll scroll an area of the screen down
Blink switch blinking vs. intense background colors
CalcSize calc array size needed to save a screen area
Clock display a clock on the screen constantly
ClockSet set various parameters for the clock
ClrCols clear between specified columns on a row
ClrEOL clear to the end of the row
ClrEOP clear to the end of the screen
ClrSOL clear to the start of the row
ClrSOP clear to the start of the screen
CPrintScreen1 send a SCREEN 1 display to the printer
CPrintScreen2 send a SCREEN 2 display to the printer
CursorInfo return cursor visibility, current & max sizes
DClear clear a display being kept in an array
DClearSS clear a display of unusual size in an array
DelChr delete a character from the screen
DelLine delete a row from the screen
DGClear clear a CGA virtual screen
DGetScreen get an area of the screen into an array
DGQPrint write to a CGA virtual screen (SCREEN 1 type)
DGXQPrint write to a CGA virtual screen (SCREEN 2 type)
DGXQPrint1 write to a CGA virtual screen (SCREEN 2 type)
Dissolve clear the screen with special effects
DMPrint display text directly through DOS services
DOSClrEol clear from the cursor to end of line via DOS
DOSCls clears the screen using DOS output
DOSColor sets the screen color using DOS output
DOSLocate sets the cursor position using DOS output
DPutScreen put an array onto an area of the screen
DRecolor recolor text of a specified color in an array
DRecolorArea recolor a block of text in an array
DScrRest restore a saved screen from an array
DScrSave save a screen to an array or other memory
DXQPrint write text into an array
EGARest7 restore a saved screen to EGA SCREEN 7 display
EGARest8 restore a saved screen to EGA SCREEN 8 display
EGARest9 restore a saved screen to EGA SCREEN 9 display
EGASave7 save an EGA SCREEN 7 display to an array
EGASave8 save an EGA SCREEN 8 display to an array
EGASave9 save an EGA SCREEN 9 display to an array
Routine Reference
Display:
EXQPrintC display text at high speed on EGA/VGA graphics
FadeOut clear the screen with special effects
GetEGA see if an EGA is in use and get info about it
GetLine get a row of text from virtual or saved screen
GetScreen get an area of the screen into an array
GetVGAColor get the specified VGA palette setting
GetVidMode get display mode and other screen info
GQPrint display text quickly in CGA SCREEN 2 mode
GrafRest restore a saved CGA graphics screen
GrafSave save a CGA graphics screen to an array
GXQPrint display text quickly in CGA SCREEN 1
GXQPrint1 display text quickly in CGA SCREEN 1
HCls clear screen in Hercules graphics mode
HiLite highlight text on the screen
HLine draw a line in Hercules graphics mode
HMode switch between text and Herc graphics modes
HPrint display text in Hercules graphics mode
HSetPixel plot a point in Hercules graphics mode
InsChr insert a space onto the screen
InsLine insert a blank row onto the screen
LScroll scroll an area of the screen left
MPrint display text through DOS, obeying MWindow
MWindow sets a display region for MPrint
PrintScreen print the screen on a printer
PutScreen put an array onto an area of the screen
QPrint display text very quickly
ReColor change text of a selected color to a new color
ReColorArea change text in a selected area to a new color
RScroll scroll an area of the screen right
Scroll scroll an area of the screen up
ScrRest restore a saved screen from an array
ScrSave save a screen to an array
SCrunch compress a screen in an array
SetCGAColor set various aspects of CGA colors
SetVGAColor set the specified VGA palette info
Split clear the screen by scrolling different ways
TypePrint display text as if it is being typed
UnCalcAttr convert color/attribute to fore & background
UnScrunch uncompress a "scrunched" screen
VGARest13 restore a saved screen in VGA SCREEN 13 mode
VGASave13 save a VGA SCREEN 13 display to an array
XMPrint display text through DOS after translation
XQPrint display text very quickly
XQPrintOver quick text display, overlaying existing text
Routine Reference
Equipment:
CDROM see if a CD-ROM is installed and get info
Equipment find out about basic equipment (ports, memory)
ExtMem see how much extended memory is available
FloppyType see what types of floppy drives are installed
Get4DOSv get installed version of 4DOS, if any
GetDOSv get the DOS version
GetEGA see if an EGA is in use and get info about it
GetExtM see how much extended memory is available
GetLIMm see how much expanded memory is available
GetLIMv get the EMS driver version
GetMouseVer get mouse driver version and hardware info
MMCheck see if a mouse is available and # of buttons
WinCheck see what version of Windows is running, if any
File:
BRead read a byte from a file into an integer
BWrite write a byte to a file from an integer
CopyFile copy a file
DelFile delete a file
DFRead read from a file into an array
DFWrite write to a file from an array
FClose1 close a file
FCreate create a file and open it for access
FileCount count the number of matching files
FlushToDisk flush a file to disk (force it to be updated)
FOpen1 open a file
FSetEnd move to the end of a file
FSetRec move to a specific record location in a file
GetFAttr get attribute of a file
GetFDate get the date of a file
GetFTime get the time of a file
GLoad load a binary image from a file (like BLOAD)
IRead read an integer from a file
IWrite write an integer to a file
MatchFile see if a filename matches a wildcard filespec
Rename rename a file
SetFAttr set the attribute of a file
SetFTD set the time and date of a file
SFRead read from a file into a string
SFWrite write from a string into a file
Routine Reference
Input:
BIOSInkey get a key from BIOS if any is waiting
CheckKey get a key if any is waiting, or a mouse button
CheckKey3 get a key if any is waiting, or a mouse button
ClrKbd clear the keyboard buffer
DOSInkey get a key from DOS if any is waiting
EnhKbd enable/disable enhanced keyboard handling
GetKbd get state of keyboard toggles (CapsLock, etc)
GetKbd1 get state of shift keys (Control, Alt, etc)
GetKbd2 get state of shift keys (Left/Right Alt, etc)
GetKey get a key or mouse click (wait; 2-button)
GetKey3 get a key or mouse click (wait; 3-button)
GetValidKey get one of a list of valid keys
KeyPress see if a key is waiting to be retrieved
PrtSc disable the PrtSc/PrintScreen key
ScanKey get a key, if any, w/o taking it from buffer
SetKbd set state of keyboard toggles (CapsLock, etc)
SetMouseLoc set the mouse cursor position (text mode)
SpeedKey change the keyboard repeat rate
TypeIn stuff keys into buffer as if they were typed
Memory:
BlockMove copy data from one area of memory to another
DataSeg determine the default data segment (dgroup)
EMSBuffer get the bytes needed to save EMS array state
EMSClose close an EMS array
EMSGet get an element from an EMS array
EMSOpen create an EMS array
EMSPut put an element into an EMS array
EMSRest restore the EMS array state
EMSSave save the EMS array state
ExtMem see how much extended memory is available
FarPoke put byte into memory (like POKE w/o DEF SEG)
FarPokeI put word into memory (like two POKEs w/o DEF SEG)
GetExtM see how much extended memory is available
GetLIMHandles get the number of EMS handles being used
GetLIMm see how much expanded memory is available
GetLIMv get the EMS driver version
LClose close a block of expanded memory
LGet get a block of data from expanded memory
LOpen open a block of expanded memory
LPut put a block of data into expanded memory
MemSwap swap contents of one area of memory w/ another
Miscellaneous:
HandleInfo see if a handle refers to a file or a device
IntVector get the address of an interrupt handler
Reboot boot the computer (like Control-Alt-Del)
SetError set exit code to return when program ends
Routine Reference
Mouse:
CheckKey get a key if any is waiting, or a mouse button
CheckKey3 get a key if any is waiting, or a mouse button
GetKey get key or mouse click (wait for it; 2-button)
GetKey3 get key or mouse click (wait for it; 3-button)
GetMouseLoc get the mouse cursor position (text mode)
GetMouseVer get mouse driver version and hardware info
MMButton see which mouse buttons are pressed (2-button)
MMButton3 see which mouse buttons are pressed (3-button)
MMCheck see if a mouse is installed & no. of buttons
MMClick see which buttons have been pressed (2-button)
MMClick3 see which buttons have been pressed (3-button)
MMCursorOff make the mouse cursor invisible
MMCursorOn make the mouse cursor visible
MMGetLoc get the mouse cursor position
MMSetLoc set the mouse cursor position
MMSetRange set the allowable range of the mouse cursor
MouseBuffer get no. of bytes needed to save mouse state
MouseCursor set the mouse graphics cursor type
MousePen turn light pen emulation by the mouse on/off
MouseRest restore a saved mouse state
MouseSave save the current state of the mouse
SetMouseLoc set the mouse cursor position (text mode)
Numeric:
Dec2Any convert an integer to any base
ReadBitF read value of given bit length from an array
RotateL rotate the bits in an integer left
RotateR rotate the bits in an integer right
SetBit set a specified bit in an integer
ShiftL shift the bits in an integer left
ShiftR shift the bits in an integer right
WriteBitF write value of given bit length into an array
Printer:
CPrintScreen1 send a SCREEN 1 display to the printer
CPrintScreen2 send a SCREEN 2 display to the printer
GetPrtAddr get the address of a printer port
PrinterInit initialize a printer
PrintFile send a file to the printer
PrintScreen print the screen on the printer
PrtSc disable the PrtSc/PrintScreen key
PrtSwap swap any two printer ports
SetPrtAddr set the address of a printer port
Spooler see if DOS print spooler (PRINT.COM) is loaded
Routine Reference
Serial:
Carrier determine if a carrier is present
CRC calculate a CRC for a string (obsolete)
CRC1 calculate a CRC for a string
DTR set the state of the DTR line
GetCommAddr get the address of a comm port
SetComm set communications parameters
SetCommAddr set the address of a comm port
String:
AndSt AND the bytes in two strings together
Bickel compare two strings using Bickel's algorithm
BSq compress the blanks out of a text string
BUsq restore a string that was compressed by BSq
BUsqLen determine expanded length of a BSq'ed string
Cipher perform simple string encryption/decryption
CipherP like Cipher, only the results are printable
CRC calculate a 16-bit CRC
Crunch remove repeated values from a string
DGetRec get a string from memory in a record format
DPutRec put a string into memory in a record format
Locase convert a string to lowercase (U.S. only)
Locase1 convert a string to lowercase (international)
LRotate rotate the characters in a string left once
MatchFile see if filename matches a wildcard filespec
Month0 return the name of the month, given month no.
MultiAND perform an arithmetic AND operation on string
MultiOR perform an arithmetic OR operation on a string
MultiXOR perform an arithmetic XOR operation on string
OrSt OR bytes in one string with those in another
Replace replace one character with another
Reverse reverse a string
RRotate rotate the characters in a string right once
SFRead read a string from a file
SFWrite write a string to a file
ShlSt shift the bits in a string left
ShrSt shift the bits in a string right
Soundex determine what a string "sounds" like
StrDel delete a character from a string
StrIns insert a space into a string
StripBlanks strip the blanks from side(s) of a string
StripChar strip a specified list of chars from a string
StripRange strip a specified range of chars from a string
StripSpaces strip the spaces from side(s) of a string
TInstr search for a specific kind of char in a string
Upcase convert a string to uppercase (U.S. only)
Upcase1 convert a string to uppercase (international)
Xlate run each char of a string through translation
XorSt XOR bytes in one string with those in another
Routine Reference
Time:
Clock display a clock on the screen, constantly
ClockSet set the parameters for the clock
Date2Int squash a date into a single integer
DateN2S convert a date from numbers into a string
DateS2N convert a date from string form into numbers
Delay delay for a given number of seconds
Delay18th delay for a given number of 18ths of seconds
DelayV delay for a very small amount of time
GetDateAT get the date from the AT hardware clock
GetDateF get date of a file matched with FindFirstF
GetFDate get the date of a file
GetFTime get the time of a file
GetTime get time from DOS, including 100th seconds
GetTimeAT get the time from the AT hardware clock
GetTimeF get time of a file matched with FindFirstF
Int2Date unsquash date from single integer to numbers
Int2Time unsquash time from single integer to numbers
Month0 return name of month, given the month number
SetDateAT set the date of the AT hardware clock
SetTimeAT set the time of the AT hardware clock
Time2Int squash a time into a single integer
TimeN2S convert a time from numbers into a string
TimeS2N convert a time from a string into numbers
WeekDay0 get the day of the week
Enhanced Key Codes
This is a list of the new key codes available when you use
EnhKbd to enable enhanced keyboard support. Note that the
codes are direct from the BIOS, and may not always match what
INKEY$ returns. QuickBasic 4.5 provides only minimal support
for the enhanced keys; QBX does much better; earlier compilers
don't know from enhanced keys. As long as you use PBBack for
input, of course, you don't have to worry about it.
The format used is ScanCode, ASCIIcode.
Middle keypad key (num lock off): 0,76
Middle key, with Control: 0,143
plain shift control alt
----- ----- ------- -----
F11 0,133 0,135 0,137 0,139
F12 0,134 0,136 0,138 0,140
The middle cursor pad returns the same scan codes as the
cursor/numeric pad when NumLock is off, but with an ASCII code
of 224 instead of 0. If you want the middle cursor pad and
cursor/numeric pad to return the same values, you should have
your code do this:
' ...get key code...
IF ASCIIcode = 224 AND ScanCode <> 0 THEN ASCIIcode = 0
Why test both ASCII and scan codes? Because it is possible for
the user to enter a plain 224 by holding ALT and using the
numeric keypad, which could cause confusion.
The arrows in the middle cursor pad will return special codes
if pressed in combination with an ALT key:
up arrow 0,152
down arrow 0,160
left arrow 0,155
right arrow 0,157
Finally, the arrow keys on either cursor pad will return
special codes if pressed in combination with a CONTROL key:
middle pad cursor/num pad
---------- --------------
up arrow 224,141 0,141
down arrow 224,145 0,145
left arrow 224,115 0,115
right arrow 224,116 0,116
DOS Error Codes
Note that the number of error codes available depends on the
version of DOS in use. Older versions return fewer error
codes, meaning that the nature of the error may not be
specified as precisely as you might like. This is not a
complete list of all possible codes, but it covers the most
common ones.
-1 Unable to read or write all of the data requested
0 No error
1 Invalid function number
2 File not found
3 Path not found
4 No handle available (too many files open)
5 Access denied (file already in use or "read only")
6 Invalid handle
15 Invalid disk drive
16 Attempt to remove current directory
18 No more matching files
19 Disk is write-protected
20 Unknown unit
21 Drive not ready
22 Invalid command
23 Data CRC error
25 Seek error
26 Disk is not in DOS format
27 Sector not found
28 Printer is out of paper
29 Write fault
30 Read fault
31 General failure
32 Sharing violation
33 Lock violation
34 Invalid disk change
35 No FCB available
36 No room in file sharing buffer
80 File already exists
82 Unable to create subdirectory